package com.tengju.user.domain.model.user;

import com.tengju.user.domain.model.login.LoginResult;
import com.tengju.user.domain.model.login.UserAccount;
import com.tengju.user.domain.model.login.UserAccountId;
import com.tengju.user.domain.model.login.UserType;
import com.tengju.user.domain.shared.IdObject;

import java.time.LocalDateTime;

/**
 * @author wuziyang
 */
public interface UserAccountRepository {

    UserAccount queryUserAccount(String userName, UserType userType);

    UserAccount queryUserAccount(UserType userType, IdObject outId);

    UserAccountId store(UserAccount userAccount);

    boolean saveToken(String token,String tokenData);

    LoginResult getTokenValue(String key);

    boolean delToken(String key);

    boolean delPwdChangeToken(UserType userType,String areaCode,String mobile);


    boolean changePwd(UserAccount userAccount);

    void changeUsername(UserAccount userAccount);

    boolean login(UserAccount userAccount);

    int countTotal(UserType userType);

    int countNew(UserType userType, LocalDateTime from, LocalDateTime to);

    void deleteByUserId(UserType userType,UserId userId);
}
